/**     
 * @Title: Service.java   
 * @Package me.xxy.mq.service   
 * @Description: TODO
 * @author weiwei 
 * @date 2018年6月1日 下午5:15:45   
 * @version V1.0     
 */
package me.xxy.mq.service;

import me.xxy.mq.Message;
import me.xxy.mq.MessageTrunk;
import me.xxy.mq.client.Demo2Subscriber;
import me.xxy.mq.client.DemoSubscriber;
import me.xxy.mq.util.ContextLoader;

/**
 * @ClassName: Service
 * @Description: TODO
 * @author weiwei
 * @date 2018年6月1日 下午5:15:45
 * 
 */
public class Service {

	/**
	 * @Title: main
	 * @Description: TODO
	 * @param args
	 * @throws InterruptedException 
	 * @Reutrn void
	 */
	public static void main(String[] args) throws InterruptedException {
		MessageTrunk trunk = ContextLoader.getBean("messageTrunk");
		Message message = null;
		for (int i = 0; i < 100; i++) {
			message = new Message();
			message.setContent("Tewst_" + i);
			if(i % 2 == 0){
				message.setChannel(DemoSubscriber.DEFAULT_CHANNELS);
			} else {
				message.setChannel(Demo2Subscriber.DEFAULT_CHANNELS);
			}
			trunk.publish(message);
			Thread.sleep(3000);
		}
	}
}
